package com.byb.server.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;

import javax.persistence.*;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * 专家点评表
 */
@ApiModel(description = "专家点评表")
@Entity
@Table(name = "expert_opinion")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "expertopinion")
public class ExpertOpinion implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 专家头像
     */
    @ApiModelProperty(value = "专家头像")
    @Column(name = "expert_header_img")
    private String expertHeaderImg;

    /**
     * 头衔
     */
    @ApiModelProperty(value = "头衔")
    @Column(name = "honor")
    private String honor;

    /**
     * 姓名
     */
    @ApiModelProperty(value = "姓名")
    @Column(name = "expert_name")
    private String expertName;

    /**
     * 专家评论
     */
    @ApiModelProperty(value = "专家评论")
    @Lob
    @Column(name = "expert_comment")
    private String expertComment;

    /**
     * 专家评分
     */
    @ApiModelProperty(value = "专家评分")
    @Column(name = "expert_score")
    private String expertScore;

    /**
     * 评论日期
     */
    @ApiModelProperty(value = "评论日期")
    @Column(name = "jhi_date")
    private ZonedDateTime date;

    @ManyToOne
    private Product product;

    // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getExpertHeaderImg() {
        return expertHeaderImg;
    }

    public ExpertOpinion expertHeaderImg(String expertHeaderImg) {
        this.expertHeaderImg = expertHeaderImg;
        return this;
    }

    public void setExpertHeaderImg(String expertHeaderImg) {
        this.expertHeaderImg = expertHeaderImg;
    }

    public String getHonor() {
        return honor;
    }

    public ExpertOpinion honor(String honor) {
        this.honor = honor;
        return this;
    }

    public void setHonor(String honor) {
        this.honor = honor;
    }

    public String getExpertName() {
        return expertName;
    }

    public ExpertOpinion expertName(String expertName) {
        this.expertName = expertName;
        return this;
    }

    public void setExpertName(String expertName) {
        this.expertName = expertName;
    }

    public String getExpertComment() {
        return expertComment;
    }

    public ExpertOpinion expertComment(String expertComment) {
        this.expertComment = expertComment;
        return this;
    }

    public void setExpertComment(String expertComment) {
        this.expertComment = expertComment;
    }

    public String getExpertScore() {
        return expertScore;
    }

    public ExpertOpinion expertScore(String expertScore) {
        this.expertScore = expertScore;
        return this;
    }

    public void setExpertScore(String expertScore) {
        this.expertScore = expertScore;
    }

    public ZonedDateTime getDate() {
        return date;
    }

    public ExpertOpinion date(ZonedDateTime date) {
        this.date = date;
        return this;
    }

    public void setDate(ZonedDateTime date) {
        this.date = date;
    }

    public Product getProduct() {
        return product;
    }

    public ExpertOpinion product(Product product) {
        this.product = product;
        return this;
    }

    public void setProduct(Product product) {
        this.product = product;
    }
    // jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ExpertOpinion expertOpinion = (ExpertOpinion) o;
        if (expertOpinion.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), expertOpinion.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "ExpertOpinion{" +
            "id=" + getId() +
            ", expertHeaderImg='" + getExpertHeaderImg() + "'" +
            ", honor='" + getHonor() + "'" +
            ", expertName='" + getExpertName() + "'" +
            ", expertComment='" + getExpertComment() + "'" +
            ", expertScore='" + getExpertScore() + "'" +
            ", date='" + getDate() + "'" +
            "}";
    }
}
